﻿using System;
using Fine.Collections.Intf;
using JetBrains.Annotations;



namespace Fine.Collections.Views
{
    /// <summary>
    /// Adapts RList of <b>S</b> to RList of <b>T</b>.
    /// </summary>
    /// <typeparam name="L">type of source list.</typeparam>
    /// <typeparam name="S">type of item of the source collection.</typeparam>
    /// <typeparam name="T">type of item ot the result collection.</typeparam>
    public class RListAdaptor<L,S,T> : RCollectionAdaptor<L,S,T>,
                                       RList<T>
        where L: RList<S>
    {
        public RListAdaptor([NotNull] L source, [NotNull] Converter<S,T> converter)
            : base(source, converter) 
        {}


        public T First
        {
            get { return converter(source.First); }
        }

        public T Last
        {
            get { return converter(source.Last); }
        }


    }
}
